package asciiTablePrinting;

import java.util.ArrayList;

public abstract class ASCIITableColumn implements Columizable{

	private ArrayList<String> headlines;
	protected int columnWidth;
	
	public ASCIITableColumn(ArrayList<String> headlines,int columnWidth){
		setColumnWidth(columnWidth);
		setHeadlines(headlines);
	}
	
	@Override
	public String getHeadline(int headlineNumber) {
		String headline=headlines.get(headlineNumber);
		String formatString="%"+columnWidth+"s";
		headline=String.format(formatString, headline);
		return headline;
	}

	@Override
	public int getHeadlineCount() {
		return headlines.size();
	}

	public void setHeadlines(ArrayList<String> headlines) {
		this.headlines = headlines;
	}

	public void setColumnWidth(int columnWidth) {
		this.columnWidth = columnWidth;
	}

	
}
